//
//  ViewController.m
//  TextFieldTest
//
//  Created by Tpphha on 15/12/16.
//  Copyright © 2015年 Tpphha. All rights reserved.
//

#import "ViewController.h"
#import "TPPasswordTextView.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];

    TPPasswordTextView *view4 = [[TPPasswordTextView alloc] initWithFrame:CGRectMake(30 , 140 , self.view.frame.size.width - 60 , 44)];
    
    //  背景色 方便  看
    view4.backgroundColor = [UIColor whiteColor];
    
    //  密码框个数
    view4.elementCount = 6;
    
    //  距离
    view4.elementMargin = 5;
    
    // 边框宽度
    view4.elementBorderWidth = 1;
    
    [self.view addSubview:view4];
    
    
    //实现block
    view4.passwordDidChangeBlock = ^(NSString *password){
        NSLog(@" 密码是 :  %@",password);
    };
    
}


//  点击 屏幕  取消第一响应者
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
